/*
 * (C) 2012	Sheng Yi
 * use dup/dup2
 */
#include "apue.h"

int main()
{
	int n, len;
	int fd;
	char* buf = "hello\n";
	len = strlen(buf);
	if (len != write(STDOUT_FILENO, buf, len))
		err_quit("write error");

	fd = dup(STDOUT_FILENO);

	if (len != write(fd, buf, len))
		err_quit("write error");

	return 0;
}
